home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4504 < prev    next >
Encoding:
Text File  |  1996-08-05  |  634 b   |  26 lines

  1. Path: iafrica.com!usenet
  2. From: Pieter Malan <vizier@iafrica.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Compiler error on long multiplication?
  5. Date: 5 Feb 1996 08:41:04 GMT
  6. Organization: Internet Africa
  7. Message-ID: <4f4fr0$pea@newnews.iafrica.com>
  8. NNTP-Posting-Host: slipper124229.iafrica.com
  9.  
  10. This code was compiled with 3.1.  When compiled for 80386, the 
  11. one onswer is wrong as indicated.  For all other processors the 
  12. answer is correct.  WHY??
  13.  
  14. void main()
  15. {
  16. unsigned long a;  //OR SIGNED
  17. unsigned long x;
  18.  
  19.         a = 1;
  20.         x = (a * 100L) * 100L;    // x = 13379344 WRONG!!!
  21.         a = 100;
  22.         x = a * 100L;        // x = 10000
  23.  
  24. }
  25.  
  26.